package com.erp.model.login
{
	import com.adobe.cairngorm.CairngormError;
	import com.adobe.cairngorm.CairngormMessageCodes;
	import com.adobe.cairngorm.model.ModelLocator;
	import com.erp.control.BaseEvent;

	import flash.events.Event;

	import mx.controls.Alert;

	//绑定全局View数据
	[Bindable]
	public class LoginModelLocator implements ModelLocator
	{

		private var _loginSuccess:Boolean;
		private var _showStr:String;

		private var _url:String;


		private static var instance:LoginModelLocator;

		//单例模式
		public function LoginModelLocator()
		{
			if (instance == !null)
			{
				throw new CairngormError(CairngormMessageCodes.SINGLETON_EXCEPTION, "UserModelLocator");
			}
			instance=this;
		}

		public static function getInstance():LoginModelLocator
		{
			if (instance == null)
			{
				instance=new LoginModelLocator();
			}
			return instance;
		}

		public function changeStack(loginSuccess:Boolean):void
		{
			this.loginSuccess=loginSuccess;
			if (loginSuccess == true)
			{
				dispatchEvent(new Event(BaseEvent.LOGIN_SUCCESS));
			}
		}

		public function logout(logout:Boolean):void
		{
			if (logout == false)
			{
				dispatchEvent(new Event(BaseEvent.LOGOUT));
			}
		}

		//----------------------------------------------------------------------------------------------------
		public function get showStr():String
		{
			return _showStr;
		}

		public function set showStr(value:String):void
		{
			_showStr=value;
		}

		public function get loginSuccess():Boolean
		{
			return _loginSuccess;
		}

		public function set loginSuccess(value:Boolean):void
		{
			_loginSuccess=value;
		}

		public function get url():String
		{
			return _url;
		}

		public function set url(value:String):void
		{
			_url=value;
		}


	}
}